home *** CD-ROM | disk | FTP | other *** search
/ Network PC / Network PC.iso / windows 95 utilities / programming tools / extended pagecontrol / extpage.hpp < prev    next >
C/C++ Source or Header  |  1997-04-19  |  16KB  |  331 lines

  1. //-------------------------------------------------------------//
  2. //                                                             //
  3. //     ExtPage.hpp                                             //
  4. //     Header of components Extended PageControl and           //
  5. //     Extended TabControl v2.2 for Borland C++Builder         //
  6. //                                                             //
  7. //     Copy this file into your C++Builder Include directory   //
  8. //                                                             //
  9. //-------------------------------------------------------------//
  10. #ifndef ExtPageHPP
  11. #define ExtPageHPP
  12. //----------------------------------------------------------------------------
  13. #include <CommCtrl.hpp>
  14. #include <ComCtrls.hpp>
  15. #include <StdCtrls.hpp>
  16. #include <Controls.hpp>
  17. #include <Graphics.hpp>
  18. #include <Classes.hpp>
  19. #include <SysUtils.hpp>
  20. #include <Messages.hpp>
  21. #include <Windows.hpp>
  22. #include <System.hpp>
  23. namespace Extpage
  24. {
  25. //-- type declarations -------------------------------------------------------
  26. enum TExtGlyphPosition { glPosLeft, glPosTop };
  27.  
  28. class __declspec(delphiclass) TExtGlyphs;
  29. class __declspec(pascalimplementation) TExtGlyphs : public Classes::TPersistent
  30. {
  31.     typedef Classes::TPersistent inherited;
  32.  
  33. private:
  34.     Graphics::TBitmap* FGlyph;
  35.     Graphics::TBitmap* FGlyphPaint;
  36.     Controls::TControl* FGlpyhOwner;
  37.     Controls::TImageList* FImageList;
  38.     Word FNumGlyphs;
  39.     Classes::TNotifyEvent FOnChange;
  40.     Classes::TNotifyEvent FOnChangeGlyph;
  41.     TExtGlyphPosition FPosition;
  42.     int FSpacing;
  43.     Graphics::TColor FTransparentColor;
  44.     void __fastcall SetGlyph(Graphics::TBitmap* p0);
  45.     void __fastcall SetNumGlyphs(Word p0);
  46.     void __fastcall SetPosition(TExtGlyphPosition p0);
  47.     void __fastcall SetSpacing(int p0);
  48.     void __fastcall SetTransparentColor(Graphics::TColor p0);
  49.  
  50. protected:
  51.     void __fastcall Changed(System::TObject* p0);
  52.     void __fastcall ChangedGlyph(System::TObject* p0);
  53.  
  54. public:
  55.     __fastcall TExtGlyphs(Controls::TControl* p0);
  56.     __fastcall virtual ~TExtGlyphs(void);
  57.     __property Controls::TImageList* ImageList = {read=FImageList, nodefault};
  58.     __property Classes::TNotifyEvent OnChange = {read=FOnChange, write=FOnChange};
  59.     __property Classes::TNotifyEvent OnChangeGlyph = {read=FOnChangeGlyph, write=FOnChangeGlyph};
  60.  
  61. __published:
  62.     __property Graphics::TBitmap* Glyph = {read=FGlyph, write=SetGlyph, nodefault};
  63.     __property Word NumGlyphs = {read=FNumGlyphs, write=SetNumGlyphs, default=0};
  64.     __property TExtGlyphPosition Position = {read=FPosition, write=SetPosition, default=0};
  65.     __property int Spacing = {read=FSpacing, write=SetSpacing, default=5};
  66.     __property Graphics::TColor TransparentColor = {read=FTransparentColor, write=SetTransparentColor,
  67.         default=16711935};
  68. };
  69.  
  70. class __declspec(delphiclass) EExtPageInvalidCall;
  71. class __declspec(pascalimplementation) EExtPageInvalidCall : public Sysutils::Exception
  72. {
  73.     typedef Sysutils::Exception inherited;
  74.  
  75. public:
  76.     /* Exception.Create */ __fastcall EExtPageInvalidCall(const System::AnsiString Msg) : Sysutils::Exception(
  77.         Msg) { }
  78.     /* Exception.CreateFmt */ __fastcall EExtPageInvalidCall(const System::AnsiString Msg, const System::TVarRec
  79.         * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
  80.     /* Exception.CreateRes */ __fastcall EExtPageInvalidCall(int Ident) : Sysutils::Exception(Ident) { }
  81.  
  82.     /* Exception.CreateResFmt */ __fastcall EExtPageInvalidCall(int Ident, const System::TVarRec * Args
  83.         , const int Args_Size) : Sysutils::Exception(Ident, Args, Args_Size) { }
  84.     /* Exception.CreateHelp */ __fastcall EExtPageInvalidCall(const System::AnsiString Msg, int AHelpContext
  85.         ) : Sysutils::Exception(Msg, AHelpContext) { }
  86.     /* Exception.CreateFmtHelp */ __fastcall EExtPageInvalidCall(const System::AnsiString Msg, const System::TVarRec
  87.         * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext
  88.         ) { }
  89.     /* Exception.CreateResHelp */ __fastcall EExtPageInvalidCall(int Ident, int AHelpContext) : Sysutils::
  90.         Exception(Ident, AHelpContext) { }
  91.     /* Exception.CreateResFmtHelp */ __fastcall EExtPageInvalidCall(int Ident, const System::TVarRec *
  92.         Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Ident, Args, Args_Size, AHelpContext
  93.         ) { }
  94.  
  95. public:
  96.     /* TObject.Destroy */ __fastcall virtual ~EExtPageInvalidCall(void) { }
  97.  
  98. };
  99.  
  100. typedef void __fastcall (__closure *TExtNbDrawTabEvent)(Controls::TWinControl* Control, int Index, bool
  101.     ActiveTab, const Windows::TRect &RectFg, const Windows::TRect &RectBg, Stdctrls::TOwnerDrawState State
  102.     );
  103.  
  104. enum TExtTabStyle { tabStDefault, tabStButton };
  105.  
  106. enum TExtTabPosition { tabPosLeft, tabPosRight, tabPosTop, tabPosBottom };
  107.  
  108. class __declspec(delphiclass) TExtPageControl;
  109. class __declspec(pascalimplementation) TExtPageControl : public Comctrls::TPageControl
  110. {
  111.     typedef Comctrls::TPageControl inherited;
  112.  
  113. private:
  114.     Graphics::TCanvas* FCanvas;
  115.     System::AnsiString FHintOrg;
  116.     bool FirstPaint;
  117.     int FLastTabHintIndex;
  118.     TExtNbDrawTabEvent FOnDrawTab;
  119.     Graphics::TColor FTabActiveColor;
  120.     Graphics::TFont* FTabActiveFont;
  121.     TExtGlyphs* FTabGlyphs;
  122.     Word FTabHeight;
  123.     Classes::TStringList* FTabHints;
  124.     Graphics::TColor FTabInactiveColor;
  125.     Graphics::TFont* FTabInactiveFont;
  126.     TExtTabPosition FTabPosition;
  127.     TExtTabStyle FTabStyle;
  128.     Word FTabWidth;
  129.     bool FTabWordWrap;
  130.     bool StopBGPainting;
  131.     bool StopBGPaintingTabs;
  132.     bool StopFGPaintingTabs;
  133.     void __fastcall CheckAndSetHWndFont(void);
  134.     Comctrls::TTabSheet* __fastcall GetActivePage(void);
  135.     HIDESBASE void __fastcall SetActivePage(Comctrls::TTabSheet* p0);
  136.     void __fastcall SetTabActiveColor(Graphics::TColor p0);
  137.     void __fastcall SetTabActiveFont(Graphics::TFont* p0);
  138.     void __fastcall SetTabGlyphs(TExtGlyphs* p0);
  139.     HIDESBASE void __fastcall SetTabHeight(Word p0);
  140.     void __fastcall SetTabHints(Classes::TStringList* p0);
  141.     void __fastcall SetTabInactiveColor(Graphics::TColor p0);
  142.     void __fastcall SetTabInactiveFont(Graphics::TFont* p0);
  143.     void __fastcall SetTabPosition(TExtTabPosition p0);
  144.     void __fastcall SetTabStyle(TExtTabStyle p0);
  145.     HIDESBASE void __fastcall SetTabWidth(Word p0);
  146.     void __fastcall SetTabWordWrap(bool p0);
  147.     HIDESBASE MESSAGE void __fastcall CMDialogChar(Messages::TWMKey &p0);
  148.     HIDESBASE MESSAGE void __fastcall CMFontChanged(Messages::TMessage &p0);
  149.     MESSAGE void __fastcall CMHintShow(Messages::TMessage &p0);
  150.     HIDESBASE MESSAGE void __fastcall CMParentColorChanged(Messages::TMessage &p0);
  151.     MESSAGE void __fastcall CNDrawTab(Messages::TWMDrawItem &p0);
  152.     MESSAGE void __fastcall TCMInsertItem(Messages::TMessage &p0);
  153.     HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TWMEraseBkgnd &p0);
  154.     HIDESBASE MESSAGE void __fastcall WMLButtonDown(Messages::TWMMouse &p0);
  155.     HIDESBASE MESSAGE void __fastcall WMPaint(Messages::TWMPaint &p0);
  156.     HIDESBASE MESSAGE void __fastcall WMSetCursor(Messages::TWMSetCursor &p0);
  157.  
  158. protected:
  159.     virtual void __fastcall ChangeScale(int p0, int p1);
  160.     virtual void __fastcall CreateParams(Controls::TCreateParams &p0);
  161.     virtual void __fastcall CreateWnd(void);
  162.     virtual void __fastcall FillTabBG(HDC p0, bool p1, const Windows::TRect &p2);
  163.     virtual int __fastcall GetTabNumber(const tagPOINT &p0);
  164.     void __fastcall GlyphHasChanged(System::TObject* p0);
  165.     void __fastcall GlyphHasChangedPicture(System::TObject* p0);
  166.     virtual void __fastcall Loaded(void);
  167.     virtual void __fastcall ReAlignTabSheets(void);
  168.     virtual void __fastcall TabFontChanged(System::TObject* p0);
  169.     virtual tagPOINT __fastcall TabTextOut(const Windows::TRect &p0, const tagPOINT &p1,  System::AnsiString
  170.         p2, Classes::TAlignment p3, bool p4);
  171.  
  172. public:
  173.     __fastcall virtual TExtPageControl(Classes::TComponent* p0);
  174.     __fastcall virtual ~TExtPageControl(void);
  175.     virtual void __fastcall BeginUpdate(void);
  176.     virtual void __fastcall DefaultDrawTab(int p0, const Windows::TRect &p1, Stdctrls::TOwnerDrawState
  177.         p2);
  178.     virtual void __fastcall DestroyAllOtherSheetHandles(void);
  179.     virtual void __fastcall DrawTab(int p0, bool p1, const Windows::TRect &p2, const Windows::TRect
  180.         &p3, Stdctrls::TOwnerDrawState p4);
  181.     virtual void __fastcall EndUpdate(void);
  182.     int __fastcall GetPageIndexByTabIndex(int p0);
  183.     virtual void __fastcall GetSheetRect(Windows::TRect &p0);
  184.     bool __fastcall IsNewComCtl(void);
  185.     __property Graphics::TCanvas* Canvas = {read=FCanvas, nodefault};
  186.  
  187. __published:
  188.     __property Comctrls::TTabSheet* ActivePage = {read=GetActivePage, write=SetActivePage, nodefault};
  189.     __property Color ;
  190.     __property ParentColor ;
  191.     __property Graphics::TColor TabActiveColor = {read=FTabActiveColor, write=SetTabActiveColor, nodefault
  192.         };
  193.     __property Graphics::TFont* TabActiveFont = {read=FTabActiveFont, write=SetTabActiveFont, nodefault
  194.         };
  195.     __property TExtGlyphs* TabGlyphs = {read=FTabGlyphs, write=SetTabGlyphs, nodefault};
  196.     __property Word TabHeight = {read=FTabHeight, write=SetTabHeight, nodefault};
  197.     __property Classes::TStringList* TabHints = {read=FTabHints, write=SetTabHints, nodefault};
  198.     __property Graphics::TColor TabInactiveColor = {read=FTabInactiveColor, write=SetTabInactiveColor,
  199.         nodefault};
  200.     __property Graphics::TFont* TabInactiveFont = {read=FTabInactiveFont, write=SetTabInactiveFont, nodefault
  201.         };
  202.     __property TExtTabPosition TabPosition = {read=FTabPosition, write=SetTabPosition, default=2};
  203.     __property TExtTabStyle TabStyle = {read=FTabStyle, write=SetTabStyle, default=0};
  204.     __property Word TabWidth = {read=FTabWidth, write=SetTabWidth, nodefault};
  205.     __property bool TabWordWrap = {read=FTabWordWrap, write=SetTabWordWrap, default=0};
  206.     __property TExtNbDrawTabEvent OnDrawTab = {read=FOnDrawTab, write=FOnDrawTab};
  207. public:
  208.     /* TWinControl.CreateParented */ __fastcall TExtPageControl(HWND ParentWindow) : Comctrls::TPageControl(
  209.         ParentWindow) { }
  210.  
  211. };
  212.  
  213. class __declspec(delphiclass) TExtTabControl;
  214. class __declspec(pascalimplementation) TExtTabControl : public Comctrls::TTabControl
  215. {
  216.     typedef Comctrls::TTabControl inherited;
  217.  
  218. private:
  219.     Graphics::TCanvas* FCanvas;
  220.     System::AnsiString FHintOrg;
  221.     bool FirstPaint;
  222.     int FLastTabHintIndex;
  223.     TExtNbDrawTabEvent FOnDrawTab;
  224.     Graphics::TColor FTabActiveColor;
  225.     Graphics::TFont* FTabActiveFont;
  226.     Classes::TList* FTabDisabledList;
  227.     TExtGlyphs* FTabGlyphs;
  228.     Word FTabHeight;
  229.     Classes::TStringList* FTabHints;
  230.     Graphics::TColor FTabInactiveColor;
  231.     Graphics::TFont* FTabInactiveFont;
  232.     TExtTabPosition FTabPosition;
  233.     TExtTabStyle FTabStyle;
  234.     Word FTabWidth;
  235.     bool FTabWordWrap;
  236.     bool StopBGPainting;
  237.     bool StopBGPaintingTabs;
  238.     bool StopFGPaintingTabs;
  239.     void __fastcall CheckAndSetHWndFont(void);
  240.     bool __fastcall GetTabEnabled(int p0);
  241.     HIDESBASE int __fastcall GetTabIndex(void);
  242.     void __fastcall SetTabActiveColor(Graphics::TColor p0);
  243.     void __fastcall SetTabActiveFont(Graphics::TFont* p0);
  244.     void __fastcall SetTabEnabled(int p0, bool p1);
  245.     void __fastcall SetTabGlyphs(TExtGlyphs* p0);
  246.     HIDESBASE void __fastcall SetTabHeight(Word p0);
  247.     void __fastcall SetTabHints(Classes::TStringList* p0);
  248.     void __fastcall SetTabInactiveColor(Graphics::TColor p0);
  249.     void __fastcall SetTabInactiveFont(Graphics::TFont* p0);
  250.     HIDESBASE void __fastcall SetTabIndex(int p0);
  251.     void __fastcall SetTabPosition(TExtTabPosition p0);
  252.     void __fastcall SetTabStyle(TExtTabStyle p0);
  253.     HIDESBASE void __fastcall SetTabWidth(Word p0);
  254.     void __fastcall SetTabWordWrap(bool p0);
  255.     HIDESBASE MESSAGE void __fastcall CMDialogChar(Messages::TWMKey &p0);
  256.     HIDESBASE MESSAGE void __fastcall CMFontChanged(Messages::TMessage &p0);
  257.     MESSAGE void __fastcall CMHintShow(Messages::TMessage &p0);
  258.     HIDESBASE MESSAGE void __fastcall CMParentColorChanged(Messages::TMessage &p0);
  259.     MESSAGE void __fastcall CNDrawTab(Messages::TWMDrawItem &p0);
  260.     MESSAGE void __fastcall TCMInsertItem(Messages::TMessage &p0);
  261.     HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TWMEraseBkgnd &p0);
  262.     HIDESBASE MESSAGE void __fastcall WMLButtonDown(Messages::TWMMouse &p0);
  263.     HIDESBASE MESSAGE void __fastcall WMPaint(Messages::TWMPaint &p0);
  264.     HIDESBASE MESSAGE void __fastcall WMSetCursor(Messages::TWMSetCursor &p0);
  265.  
  266. protected:
  267.     virtual void __fastcall ChangeScale(int p0, int p1);
  268.     virtual void __fastcall CreateParams(Controls::TCreateParams &p0);
  269.     virtual void __fastcall CreateWnd(void);
  270.     virtual void __fastcall FillTabBG(HDC p0, bool p1, const Windows::TRect &p2);
  271.     virtual int __fastcall GetTabNumber(const tagPOINT &p0);
  272.     void __fastcall GlyphHasChanged(System::TObject* p0);
  273.     void __fastcall GlyphHasChangedPicture(System::TObject* p0);
  274.     virtual void __fastcall Loaded(void);
  275.     virtual void __fastcall TabFontChanged(System::TObject* p0);
  276.     virtual tagPOINT __fastcall TabTextOut(const Windows::TRect &p0, const tagPOINT &p1,  System::AnsiString
  277.         p2, Classes::TAlignment p3, bool p4);
  278.  
  279. public:
  280.     __fastcall virtual TExtTabControl(Classes::TComponent* p0);
  281.     __fastcall virtual ~TExtTabControl(void);
  282.     virtual void __fastcall BeginUpdate(void);
  283.     virtual void __fastcall DefaultDrawTab(int p0, const Windows::TRect &p1, Stdctrls::TOwnerDrawState
  284.         p2);
  285.     virtual void __fastcall DrawTab(int p0, bool p1, const Windows::TRect &p2, const Windows::TRect
  286.         &p3, Stdctrls::TOwnerDrawState p4);
  287.     virtual void __fastcall EndUpdate(void);
  288.     virtual void __fastcall GetSheetRect(Windows::TRect &p0);
  289.     bool __fastcall IsNewComCtl(void);
  290.     __property Graphics::TCanvas* Canvas = {read=FCanvas, nodefault};
  291.     __property bool TabEnabled[int Index] = {read=GetTabEnabled, write=SetTabEnabled};
  292.  
  293. __published:
  294.     __property Color ;
  295.     __property ParentColor ;
  296.     __property Graphics::TColor TabActiveColor = {read=FTabActiveColor, write=SetTabActiveColor, nodefault
  297.         };
  298.     __property Graphics::TFont* TabActiveFont = {read=FTabActiveFont, write=SetTabActiveFont, nodefault
  299.         };
  300.     __property TExtGlyphs* TabGlyphs = {read=FTabGlyphs, write=SetTabGlyphs, nodefault};
  301.     __property Word TabHeight = {read=FTabHeight, write=SetTabHeight, nodefault};
  302.     __property Classes::TStringList* TabHints = {read=FTabHints, write=SetTabHints, nodefault};
  303.     __property Graphics::TColor TabInactiveColor = {read=FTabInactiveColor, write=SetTabInactiveColor,
  304.         nodefault};
  305.     __property Graphics::TFont* TabInactiveFont = {read=FTabInactiveFont, write=SetTabInactiveFont, nodefault
  306.         };
  307.     __property int TabIndex = {read=GetTabIndex, write=SetTabIndex, nodefault};
  308.     __property TExtTabPosition TabPosition = {read=FTabPosition, write=SetTabPosition, default=2};
  309.     __property TExtTabStyle TabStyle = {read=FTabStyle, write=SetTabStyle, default=0};
  310.     __property Word TabWidth = {read=FTabWidth, write=SetTabWidth, nodefault};
  311.     __property bool TabWordWrap = {read=FTabWordWrap, write=SetTabWordWrap, default=0};
  312.     __property TExtNbDrawTabEvent OnDrawTab = {read=FOnDrawTab, write=FOnDrawTab};
  313. public:
  314.     /* TWinControl.CreateParented */ __fastcall TExtTabControl(HWND ParentWindow) : Comctrls::TTabControl(
  315.         ParentWindow) { }
  316.  
  317. };
  318.  
  319. //-- var, const, procedure ---------------------------------------------------
  320. #define TCS_BOTTOM (Byte)(2)
  321. #define TCS_RIGHT (Byte)(2)
  322. #define TCS_VERTICAL (Byte)(128)
  323. extern void __fastcall Register(void);
  324.  
  325. }   /* namespace Extpage */
  326. #if !defined(NO_IMPLICIT_NAMESPACE_USE)
  327. using namespace Extpage;
  328. #endif
  329. //-- end unit ----------------------------------------------------------------
  330. #endif  // ExtPage
  331.